package light.head.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import light.head.constant.Sys;

import org.hibernate.annotations.Formula;
/**
 * 审核状态表
 */
@Table
@Entity
public class AuditStatus implements Serializable{


	private static final long serialVersionUID = -4245145304857554248L;
	
	private Integer code;
	private Integer pcc;			// 流程配置编号
	private Integer cu;				// 申请人编号
	private Date ct;				// 申请时间
	private Byte status = Sys.B_THREE;	// 审核状态(1.审核通过 2.审核不通过 3.未审核 4.移交)
	private String remark;			// 备注
	private Integer oc;				// 申请人机构编号
	private Integer mc;				// 业务模块信息编号(申请编号)
	private Byte business;			// 业务编号(1.物品申请，2.请假申请 3.用车申请4.报销申请5.离职流程6.负责人请假离职流程)
	private Integer rc;				// 审核角色编号
	private Integer au;				// 审核人编号
	private Date at;				// 审核时间
	private Integer pc;				// 审核序号
	private Byte beforeStatus;		// 上一节点的审核状态
	
	private String auName;			// 审核人名称
	private String on;				// 申请人机构名称
	private String rn;
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getPcc() {
		return pcc;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public Byte getStatus() {
		return status;
	}
	@Column
	public String getRemark() {
		return remark;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	
	@Column
	public Byte getBusiness() {
		return business;
	}
	@Column
	public Integer getMc() {
		return mc;
	}

	@Column
	public Integer getRc() {
		return rc;
	}
	@Column
	public Integer getAu() {
		return au;
	}
	@Column
	@Temporal(TemporalType.TIMESTAMP)
	public Date getAt() {
		return at;
	}
	@Column
	public Integer getPc() {
		return pc;
	}

	@Column
	public Byte getBeforeStatus() {
		return beforeStatus;
	}
	
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = au)")
	public String getAuName() {
		return auName;
	}
	@Formula("(SELECT r.name FROM Role r WHERE r.code = rc)")
	public String getRn() {
		return rn;
	}
	

	

	
	public void setRn(String rn) {
		this.rn = rn;
	}
	public void setBeforeStatus(Byte beforeStatus) {
		this.beforeStatus = beforeStatus;
	}
	public void setPc(Integer pc) {
		this.pc = pc;
	}
	public void setRc(Integer rc) {
		this.rc = rc;
	}
	public void setAu(Integer au) {
		this.au = au;
	}
	public void setAt(Date at) {
		this.at = at;
	}
	public void setAuName(String auName) {
		this.auName = auName;
	}
	public void setMc(Integer mc) {
		this.mc = mc;
	}
	
	public void setBusiness(Byte business) {
		this.business = business;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setPcc(Integer pcc) {
		this.pcc = pcc;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setOn(String on) {
		this.on = on;
	}
}
